import requests
import json


def insert_item(key, value):
    item_url = 'http://127.0.0.1:6789/items'
    res = requests.get(f'{item_url}/{key}/{value}')
    return res.text


def query_item(key):
    item_url = 'http://127.0.0.1:6789/items'
    res = requests.get(f'{item_url}/{key}')
    return res.text


if __name__ == '__main__':
    base_url = 'http://127.0.0.1:6789/'
    res = requests.get(base_url)
    print(res.text)
    js = json.loads(res.text)
    print(js['Hello'])

    insert_item('a', 1)
    insert_item('a', 10)
    insert_item('b', 2)
    insert_item('c', 3)

    print(query_item('a'))
    print(query_item('b'))
    print(query_item('c'))
